<?
if(!$_SESSION[uname]){
	require_once 'include/train_db.php';
	require_once 'include/bottom.php';
	$smarty->compile_check = true;

   $err = "Please Login!";
   $smarty->assign("err",$err);
   $smarty->display('header.tpl');
   $smarty->display("left.tpl");
   $smarty->display("error.tpl");
   $smarty->display("right.tpl");
   $smarty->display('footer.tpl');
   exit;
}


if($_SESSION[deadline] < time()&&$_SESSION['status']=="Trial"){
   header("location:cybersource.php?utype=$_SESSION[usertype]&uname=$_SESSION[uname]&overdue=Trial");
   exit;
}
if($_SESSION['status']=="Expired"){
   header("location:cybersource.php?utype=$_SESSION[usertype]&uname=$_SESSION[uname]&overdue=Expired");
   exit;
}
if($_SESSION[deadline]-time()<864000&&$_SESSION['status']=="Trial"){
	$over = ceil(($_SESSION[deadline]-time())/86400);
    $alert_line = "You only have <font color=red>".$over."</font> days left to enjoy our services. Click <a href='cybersource.php?utype=$_SESSION[usertype]&uname=$_SESSION[uname]&overdue=1'>here</a> to buy a membership now!";
    $smarty->assign("alert",$alert_line);
}
?>